<?

/* UserController controller class.
 * This class contains the handling code, divided into action methods.
 *
 */ 
class DuelController extends AGController
{
  function __construct($ctrName) 
  {
    parent::__construct($ctrName);
    // your constructor code goes here
    $this->invokeModel();
    $this->model->character = &$this->character;
  }

  function Index()
  {
    // your default action code goes here
    $this->pageTitle = 'Duel someone'; 
  }
  
  function Attack()
  {
    include_once('lib/combat.php');
    $this->duelPartnerId = $_REQUEST['id'];
    $this->duelPartner = new CharacterModel('', $this, $this->duelPartnerId);
    $this->duelUser = DB_GetDataset('users', $this->duelPartner->charDS['c_ref_user']);
    
    $this->act = array();
    $this->act['a_name'] = 'Duelling '.$this->duelPartner->charDS['c_name'];
    $this->act['a_text'] = '"'.$this->duelPartner->charDS['c_name'].', enough of your insolence!" you shout for want of more witty bantering...';
    $this->act['a_cost'] = 1+floor($this->duelPartner->level/5);
    
    $this->duelPartner->stats['enemy'] = 'char';
    unset($this->duelPartner->stats['HP.current']);
    unset($this->duelPartner->stats['MP.current']);
    $this->duelPartner->stats['drop.gold'] = '100%,'.$this->duelPartner->level.','.$this->duelPartner->level*5;
    $this->character->stats['enemy'] = 'duel';
      
    $this->mobObjects['char.'.$this->character->charDS['c_key']] = &$this->character;
    $this->mobObjects['duel.'.$this->duelPartnerId] = &$this->duelPartner;
  }
}


?>
